package com.ruoyi.energy.controller;

import com.ruoyi.common.core.web.domain.JiMuReportResult;
import com.ruoyi.energy.domain.NyCheckReport;
import com.ruoyi.energy.domain.NyCheckSumReport;
import com.ruoyi.energy.domain.vo.MeterTreeVO;
import com.ruoyi.energy.service.INyCheckReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@Api(tags = "积木报表report")
@RestController
@RequestMapping("/jimuReport")
public class JimuReportController {

    @Autowired
    private INyCheckReportService nyCheckReportService;


    @GetMapping("/nyCheckReport")
    @ApiOperation(value = "水电明细报表", notes = "水电明细报表")
    public JiMuReportResult listNyCheckReport(NyCheckReport nyCheckReport) {
        List<NyCheckReport> result = nyCheckReportService.selectNyCheckReportList(nyCheckReport);
        return JiMuReportResult.success(result);
    }

    /**
     * meterType=电表&feeCycle=${feeCycle}&parkNum=${parkNum}
     * @param nyCheckReport
     * @return
     */
    @GetMapping("/nyCheckSumReport")
    @ApiOperation(value = "水电抄表汇总", notes = "水电抄表汇总")
    public JiMuReportResult listNyCheckReportHuiZong(NyCheckReport nyCheckReport) {
        List<NyCheckSumReport> result = nyCheckReportService.selectNyCheckSumReportList(nyCheckReport);
        return JiMuReportResult.success(result);
    }

    @GetMapping("/sumMeter")
    @ApiOperation(value = "总表", notes = "总表")
    public List<MeterTreeVO> listSumMeter(NyCheckReport nyCheckReport) {
        List<MeterTreeVO> result = nyCheckReportService.selectSumMeterList(nyCheckReport);
        return result;
    }

    @GetMapping("/parkCode")
    @ApiOperation(value = "总表", notes = "总表")
    public List<MeterTreeVO> parkCode(NyCheckReport nyCheckReport) {
        List<MeterTreeVO> result = new ArrayList<MeterTreeVO>();
        MeterTreeVO tmp1 = new MeterTreeVO();
        tmp1.setText("A");
        tmp1.setValue("A");
        result.add(tmp1);
        MeterTreeVO tmp2 = new MeterTreeVO();
        tmp2.setValue("B");
        tmp2.setText("B");
        result.add(tmp2);
        return result;
    }


}
